package main

import (
	"net/http"
	"io/ioutil"
	"strings"
	"fmt"
	"time"
)

func main(){

	client := &http.Client{
		Transport: &http.Transport{
		},
	}

	for {
                tos := "15118178454"
                content := "1111111"
                //data := fmt.Sprintf("phoneNum=%s&content=磁盘使用量告警2&alarmtpye=语音告警", tos)
                data := fmt.Sprintf("phoneNum=%s&content=%s&alarmtpye=语音告警", tos, content)
		req, err := http.NewRequest("POST", "http://sr-dev.msmartlife.cn/alert_notify/voicenotify", strings.NewReader(data))

		if err != nil {
			return
			// handle error

		}

		req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

		req.Header.Set("Cookie", "name=anny")

                req.Header.Set("Authorization", "Basic YWRtaW46YWRtaW4=")

		resp, err := client.Do(req)

		if err != nil {

			// handle error
			fmt.Println("1111")
			return
		}
		defer resp.Body.Close()

		body, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			return
		}

		fmt.Println(string(body))
		time.Sleep(1*time.Second)
                break
	}
}
